package com.rdtravel.entities;

import java.io.Serializable;
import java.util.Collections;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

@Entity
@Table(name = "continents")
public class Continent implements Serializable {
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue
	private long id;
	private String name;
	@OneToMany
	@JoinColumn(name = "continentid")
	@OrderBy("name")
	private Set<Destination> destinations;
	@OneToMany

	
	public long getId() {
		return id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Set<Destination> getDestinations() {
		return Collections.unmodifiableSet(destinations);
	}


	
	@Override
	public String toString() {
		return "Continent [id=" + id + ", name=" + name + "]";
	}
}
